import javax.servlet.ServletOutputStream;
import java.io.BufferedReader;
import java.io.IOException;

/**
 * Created by qupen on 2016/8/17.
 */
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class MonitorGateway extends javax.servlet.http.HttpServlet {
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        String line;
        StringBuffer buffer = new StringBuffer();

        BufferedReader in = new BufferedReader(new InputStreamReader(
                request.getInputStream()));

        while ((line = in.readLine()) != null) {
            buffer.append(line);
        }

        ServletOutputStream out = response.getOutputStream();

        out.write(buffer.toString().getBytes());
    }

    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello World!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Hello World!</h1>");
        out.println("</body>");
        out.println("</html>");
    }
}
